This calculator will calculate bolt hole positions for regular n-gons. "Regular" means all sides have equal lengths. "n-gon" includes triangle, square, pentagon, hexagon, heptagon, through 33-gon. This is based on data in "Machinery's Handbook 29th Edition"
All calculations are relative to the center of the polygon, i.e. the center of the bolt hole circle is assigned (0,0). Top and right are positive offsets and bottom/left are negative offsets. A vertex of the polygon is always at top center. [This is considered a Type A Bolt Hole Circle in Machinery's Handbook.] The top center hole is assigned the number one. The remaining holes are numbered in a counter-clockwise direction. For example, bolt hole locations for the five holes in a pentagon would have two holes below center, the number one hole directly above center, and two holes above and left/right of center.
If you are not working from center, then you will need to translate the dimensions provided as output to your (0,0) location. If your circle has two holes evenly centered on the top of the circle, then you will need to wait for an update to this page.
Input is straightforward. Only two parameters are required: the number of sides in your regular polygon and the diameter of your circle. One optional input choice is provided. This is whether your bolt holes are located on the circle (default) or if the sides of your polygon are tangent to the circle (i.e. the circle is 'inside' your n-gon). This latter selection is used primarily for laying out a regular polygon. For instance, you might be making a special wrench with a hexagonal hole (the project that spurred me to write this program). Drill the hole to the diameter of the nut size, layout the hexagon around this hole, and file to the layout lines.
The methodology is straight from Machinery's Handbook. The Handbook has four tables for calculating bolt holes with 3 to 33 holes. Only one (so far) of these four tables is included here as it corresponds with the layout of holes discussed above. The data is for a bolt hole circle of diameter 1. So multiplying your diameter in any dimensions by the factors from the table for the indicated number of holes provides the offsets for milling machine setup (relative to the origin).